/*
 *  Clase para cargar formularios en html
 *  *************************************************************************************************************************
 **/
/*
Form.prototype = new core();
Form.prototype.constructor = Form;

function Form(cfg){
    this.cfg = cfg;
    this.id = '';
    this.renderTo = '';
    this.autoRender = false;
    this.width = '100%';
    this.height = '100%';
    this.form = {};
    this.autoLoad = true;
    this.urlForm = '';
    this.urlAction = '';
    this.isCreated = false;
    
    this.formId = '';
    
    this.afterSuccess = null;
    this.beforeSuccess = null;
}
Form.prototype._init = function(cfg){
    if(!this.is_empty(cfg)){
        this.cfg = cfg;
    }
    
    if(this.cfg.renderTo) this.renderTo = this.cfg.renderTo;
    if(this.cfg.autoRender) this.autoRender = this.cfg.autoRender;
    if(this.cfg.width) this.width = this.cfg.width;
    if(this.cfg.height) this.height = this.cfg.height;
    if(this.cfg.urlForm) this.urlForm = this.cfg.urlForm;
    if(this.cfg.urlAction) this.urlAction = this.cfg.urlAction;
    if(this.cfg.formId) this.formId = this.cfg.formId;
    if(this.cfg.afterSuccess) this.afterSuccess = this.cfg.afterSuccess;
    this.isCreated = true;
}

Form.prototype.me = function(){
    return this;
}
Form.prototype.getWidth = function(){
    return this.width;
}
Form.prototype.getHeight = function(){
    return this.height;
}
    
Form.prototype.getUrlForm = function(){
    return this.urlForm
};
Form.prototype.getUrlAction = function(){
    return this.urlAction
};
Form.prototype.setUrlForm = function(url){
    this.urlForm = url;
};
Form.prototype.setUrlAction = function(url){
    this.urlAction = url;
};
Form.prototype.setWidth = function(width){
    if(width.indexOf('%')!="-1"){
        $(this.form).css('width',width);
    }
    else{
        $(this.form).css('width',width+'px');
    }
};
Form.prototype.setHeight = function(height){
    if(height.indexOf('%')!="-1"){
        $(this.form).css('width',height);
    }
    else{
        $(this.form).css('width',height+'px');
    }
};
    
Form.prototype._beforeLoadForm = function(data){
    return;
};

Form.prototype.Form = function(config){
    if(!this.isCreated){
        this._init(config);
    }  
    var callConfig=null;
    if(config){
        callConfig = config;
    }
    else{
        callConfig = this;
    }
    var http = new Request();

    var id = this.getId(callConfig.renderTo);
    var _this = this;

    http.request({
        url:callConfig.urlForm,
        success:function(data){
            var form = data.data;
            
            data._this = _this;
            
            if(callConfig.beforeSuccess){
                callConfig.beforeSuccess(data);
            }
            form = _this.setIdToForm(form, _this.formId);
            $(id).html(form);
            if(_this.getBeautyForms()){
                $('#'+_this.formId).jqTransform();
            }
            if(callConfig.afterSuccess){
                callConfig.afterSuccess(data);
            }
        }
    });
    return this;
};

*/
